package com.stone.inventory.core.domain.entity;

import io.choerodon.mybatis.annotation.ModifyAudit;
import io.choerodon.mybatis.annotation.VersionAudit;
import io.choerodon.mybatis.domain.AuditDomain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * 库存事务明细DB实体
 *
 * @author Mr_wenpan@163.com 2021/8/16 11:15 下午
 */
@EqualsAndHashCode(callSuper = true)
@ApiModel("库存事务明细")
@VersionAudit
@ModifyAudit
@Table(name = "o2inv_transaction")
@Data
public class InvTransaction extends AuditDomain {

    public static final String FIELD_INV_TRANSACTIONS_ID = "invTransactionsId";
    public static final String FIELD_PROCESSING_STATUS_CODE = "processingStatusCode";
    public static final String FIELD_SKU_ID = "skuId";

    @ApiModelProperty("表ID，主键，供其他表做外键")
    @Id
    @GeneratedValue
    private Long invTransactionsId;
    @ApiModelProperty(value = "服务点编码")
    @NotBlank
    private String posCode;
    @ApiModelProperty(value = "sku商品编码")
    @NotBlank
    private String skuCode;
    @ApiModelProperty(value = "事务编码")
    @NotBlank
    private String transactionCode;
    @ApiModelProperty(value = "事务类型，值集：O2INV.TRANSACTION_TYPE")
    @NotBlank
    private String transactionTypeCode;
    @ApiModelProperty(value = "处理状态，值集：O2MD.PROCESSING_STATUS")
    @NotBlank
    private String processingStatusCode;
    @ApiModelProperty(value = "现有量增量")
    @NotNull
    private Long onHandInc;
    @ApiModelProperty(value = "保留量增量")
    @NotNull
    private Long reservedInc;
    @ApiModelProperty(value = "错误消息")
    private String message;
    @ApiModelProperty(value = "来源编码")
    private String sourceCode;
    @ApiModelProperty(value = "来源明细编码")
    private String sourceDetailCode;
    @ApiModelProperty(value = "事务来源")
    @NotBlank
    private String transactionSource;
    @ApiModelProperty(value = "来源类型.值集：O2INV.SOURCE_TYPE")
    @NotBlank
    private String sourceTypeCode;
    @ApiModelProperty(value = "来源时间")
    @NotNull
    private Date sourceDate;
    @ApiModelProperty(value = "事务来源时间戳")
    private Long sourceTimestamp;
    @Transient
    private String supplierCode;
}